package com.ykunn.utils.json;

public class ResultJson {

    private String code;
    private String message;
    private Object data;

    public ResultJson(){
        this.setCode(ResultCode.SUCCESS);
        this.setMessage("OK");
    }

    public ResultJson(ResultCode resultCode){
        this.setCode(resultCode);
        this.setMessage(resultCode.getMsg());
    }

    public ResultJson(ResultCode resultcode, String message){
        this.setCode(resultcode);
        this.setMessage(message);
    }

    public ResultJson(ResultCode resultCode, String message , Object o){
        this.setCode(resultCode);
        this.setMessage(message);
        this.setData(o);
    }

    public ResultJson(ResultCode resultCode,Object o){
        this.setCode(resultCode);
        this.setMessage(resultCode.getMsg());
        this.setData(o);
    }

    public ResultJson(Object o){
        this.setCode(ResultCode.SUCCESS);
        this.setMessage(ResultCode.SUCCESS.getMsg());
        this.setData(o);
    }


    public void setMessage(String message) {
        this.message =message;
    }

    public void setCode(ResultCode resultCode) {
        this.code = resultCode.getCode();
    }

    public void setData(Object data) {
        this.data = data;
    }

    public String getMessage() {
        return message;
    }

    public String getCode() {
        return code;
    }

    public Object getData() {
        return data;
    }
}
